<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        new Promise((resolve,reject)=>{

            //请求A数据
            console.log('开始请求A数据');
            //模拟读取数据
            try{
                setTimeout(()=>{
                console.log('请求A数据成功');
                const name ={
                    name : '伏地魔'
                }
                resolve(name)

            },2000)
            }catch(e){
                reject(e.message)
            }

        })
        .then(value =>{
            return new Promise((resolve,reject)=>{
            //请求B数据
            console.log('开始请求B数据');
            //模拟读取数据
            try{
                setTimeout(()=>{
                console.log('请求B数据成功');
                const age ={
                    age : 20
                }
                resolve({...value,...age})
                
                
            },2000)
            }catch(e){
                reject(e.message)
            }
            })
        })
        .then(value=>{
            console.log(value);
        })
        
        .catch((reason)=>{
            console.log('有问题');
        })
        setTimeout()


    </script>
</body>
</html>